package com.heima.utils.thread;

import com.heima.model.user.pojos.ApUser;


public class AppThreadLocalUtil {

    private static ThreadLocal<ApUser> APP_USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 存入线程中
     * @param apUser
     */
    public static void setUser(ApUser apUser){
        APP_USER_THREAD_LOCAL.set(apUser);
    }

    /**
     * 从线程中获取
     * @return
     */
    public static ApUser getUser(){
        return APP_USER_THREAD_LOCAL.get();
    }

    /**
     * 清空
     */
    public static void clear(){
        APP_USER_THREAD_LOCAL.remove();
    }
}
